#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# author: maxiao
# date: 2023-03-15 21:56
# description: 测试多进程


import os
import time

from multiprocessing import Process


def new_process(param):
    time.sleep(5)
    print("当前子进程的PID---> {}".format(os.getpid()))
    print("从主进程传进来的参数param--->", param)


if __name__ == "__main__":
    print("父进程的PID---> {}".format(os.getpid()))
    process = Process(target=new_process, args=("主进程参数",))
    process.start()
    # 等子进程执行完毕后，再执行主（父）进程
    process.join()
    print("主进程执行完毕！")


